//
//  ZTTabBarController.m
//  DianYing5
//
//  Created by d0 on 15/7/17.
//  Copyright (c) 2015年 uskr. All rights reserved.
//
#define screenHeight [UIScreen mainScreen].bounds.size.height

#import "ZTTabBarController.h"

#import "ZTTabBar.h"

#import "VCTransport.h"

@interface ZTTabBarController ()

-(void)createAppFrame;

@end

@implementation ZTTabBarController

-(void)viewDidLoad
{
    [super viewDidLoad];
    
    //移除自带的tabBar
    [self.tabBar removeFromSuperview];
    
    //创建tabBar
    ZTTabBar *tabBar = [[ZTTabBar alloc]init];
    
    tabBar.frame = CGRectMake(self.tabBar.x, screenHeight-54, self.tabBar.width, 54);
    
    tabBar.backgroundColor = [UIColor colorWithRed:68/255.0 green:68/255.0 blue:68/255.0 alpha:1];
    
    //在点击按钮后,重新设置对应的View
    [tabBar setSelectBlock:^(NSInteger selectedIndex) {
        self.selectedIndex  = selectedIndex;
    }];

    [self createAppFrame];
    
    //self.navigationController.navigationBarHidden = YES;
    [self.view addSubview:tabBar];
}


-(void)createAppFrame
{

    VCTransport * vc1 = [[VCTransport alloc]init];
    UINavigationController * nc1 = [[UINavigationController alloc]initWithRootViewController:vc1];

    UIViewController * vc2 = [[UIViewController alloc]init];
    vc2.view.backgroundColor = [UIColor grayColor];
    UINavigationController * nc2 = [[UINavigationController alloc]initWithRootViewController:vc2];

    UIViewController * vc3 = [[UIViewController alloc]init];
    vc3.view.backgroundColor = [UIColor greenColor];
    UINavigationController * nc3 = [[UINavigationController alloc]initWithRootViewController:vc3];

    UIViewController * vc4 = [[UIViewController alloc]init];
    vc4.view.backgroundColor = [UIColor yellowColor];
    UINavigationController * nc4 = [[UINavigationController alloc]initWithRootViewController:vc4];

    UIViewController * vc5 = [[UIViewController alloc]init];
    vc5.view.backgroundColor = [UIColor magentaColor];
    UINavigationController * nc5 = [[UINavigationController alloc]initWithRootViewController:vc5];
    
    self.viewControllers = @[nc1, nc2, nc3, nc4, nc5];

}
@end
